package com.studiofortress.sf.graphics.display;

import java.awt.Dimension;
import javax.swing.JPanel;

/**
 * The GraphicsPanel class is a JPanel allowing a GraphicsDisplay to be embedded
 * into a Swing GUI.
 *
 * By default this cannot be resized, but it can be enabled. Flickering may
 * occur as the component is resized.
 * 
 * A subclass should also call display on the first time this component is
 * displayed.
 * 
 * @author Joseph Lenton
 * @version 26/12/2008
 */
public class GraphicsPanel extends GraphicsWrapper<JPanel>
{
    /**
     * This class is not meant to be implimented,
     * and is simply to create the workings for all
     * of the various types of Graphic Windows.
     */
    public GraphicsPanel(int width, int height)
    {
        super(new JPanel(), width, height);

        final JPanel innerComponent = getContainer();
        final Dimension size = new Dimension( width, height );

        innerComponent.setMinimumSize( size );
        innerComponent.setMaximumSize( size );
        innerComponent.setPreferredSize( size );
        innerComponent.setSize( size );
    }
}